<script>
	export default {
		onLaunch: function() {
			console.log('App Launch');
			console.log(this.$u.config.version);
			uni.hideTabBar()
		},
		onShow: function() {
					uni.hideTabBar()
			console.log('App Show');
		},
		onHide: function() {
			console.log('App Hide');
		},
		methods:{
			// 微信小程序订阅通知
			wxnotice(ids){
				// 获取用户当前设置
				wx.getSetting({
					withSubscriptions:true,
					success: (res) => {
						if(res.subscriptionsSetting.mainSwitch){
							wx.requestSubscribeMessage({
								tmplIds:ids,
								success:(res)=>{
									console.log('通知消息订阅成功',res)
								},
								fail:(error)=>{
									console.log('通知消息订阅失败',error)
								}
							})
							
						}else{
							uni.showModal({
								title:'提示',
								content:'是否允许小程序向您发送通知消息？',
								success(modal_res) {
									if(modal_res.confirm){
										wx.openSetting({
											withSubscriptions:true,
											success(res) {
												console.log('打开消息通知')
											}
										})
										// 授权系统通知消息订阅
										wx.requestSubscribeMessage({
											tmplIds:ids,
											success:(res)=>{
												console.log('通知消息订阅成功',res)
											}
										})
									}
								}
							})
							
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import "/static/css/button.scss";
	@import "/static/css//global.scss";
	/* #ifdef H5 */
	uni-page-head{
		display: none;
	}
	// h5限制富文本图片
	uni-rich-text img{
		max-width: 100%!important;
	}
	/* #endif */
	// 刘海屏适配代码
	// var(--status-bar-height);
	// 去除图片上下间距
	image{
		 display: block;
		 vertical-align:bottom
	}
	*{
		box-sizing: border-box;
	}
</style>
